#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+10;
int n,m,head[MAXN],cnt,ans[MAXN],in[MAXN];
struct edge
{
	int v,next;
}e[MAXN];
struct node
{
	int x,y;
	bool operator<(const node b)const
	{
		return x==b.x?y<b.y:x<b.x;
	}
}a[MAXN];
priority_queue<int>q;
void addedge(int x,int y)
{
	e[cnt]=(edge){y,head[x]};
	head[x]=cnt++;
	return;
}
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		memset(head,-1,sizeof(head));
		memset(in,0,sizeof(in));
		memset(ans,0,sizeof(ans));
		cnt=0;
		scanf("%d%d",&n,&m);
		for(int i=1;i<=m;++i)scanf("%d%d",&a[i].x,&a[i].y);
		sort(a+1,a+1+m);
		for(int i=1;i<=m;++i)
		{
			if((a[i].x!=a[i-1].x||a[i].y!=a[i-1].y)&&a[i].x!=a[i].y)
			{
				addedge(a[i].y,a[i].x);
				++in[a[i].x];
			}
		}
		cnt=n;
		for(int i=1;i<=n;++i)
			if(!in[i])q.push(i);
		while(!q.empty())
		{
			int x=q.top();
			ans[cnt--]=x;
			q.pop();
			for(int i=head[x];~i;i=e[i].next)
			{
				int v=e[i].v;
				if(!--in[v])q.push(v);
			}
		}
		if(cnt)
		{
			printf("Impossible!\n");
			continue;
		}
		for(int i=1;i<=n;++i)
			printf("%d ",ans[i]);
		printf("\n");
	}
}
